package com.blackitheima1.LambdaDemo.test2;
//接口无参无返回值
public class TestApple {
    public static void main(String[] args) {

        //匿名内部类
        eatApple(new Apple() {
            @Override
            public void eat() {
                System.out.println("得不到的苹果!");
            }
        });
        //Lambda表达式
        eatApple(()-> System.out.println("找不回的青春!"));

        //创建实现类对象
        AppleImple ai=new AppleImple();
        ai.eat();

    }
    public static void eatApple(Apple apple){
        apple.eat();
    }
}

//接口
interface Apple{
    public abstract void eat();
}
//实现类
class AppleImple implements Apple{

    @Override
    public void eat() {
        System.out.println("停不下的孤影!");
    }
}